﻿<Window x:Class="WGM_Client_Net35V2.MainWindowDefault"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WGM Beta2" MinHeight="300" MinWidth="450"
    xmlns:settings="clr-namespace:WGM_Client_Net35V2.Properties"
    
    x:Name="MainWindow"
    Style="{DynamicResource DefaultWindowStyle}" Closing="Window_Closing" SizeToContent="Manual" ShowInTaskbar="True">
    <Window.Top>
        <Binding Path="MainWindowTop" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Top>
    <Window.Left>
        <Binding Path="MainWindowLeft" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Left>
    <Window.Height>
        <Binding Path="MainWindowHeight" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Height>
    <Window.Width>
        <Binding Path="MainWindowWidth" Mode="TwoWay" Source="{x:Static settings:Settings.Default}" />
    </Window.Width>

    <Window.Resources>

        <Style TargetType="{x:Type TabItem}">
            <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Border x:Name="OuterBorder" CornerRadius="10,0,0,10" Visibility="Visible" >
                            <Border.Background>
                                <SolidColorBrush Color="Transparent"/>
                            </Border.Background>
                            <Border Grid.Column="1" Grid.Row="1" x:Name="InnerBorder" CornerRadius="10,0,0,10" Margin="2,0,0,1.5" >
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                        <GradientStop Color="{Binding Path=WindowColorScheme, Mode=OneWay, Source={x:Static settings:Settings.Default}}" Offset="-1.5"/>
                                        <GradientStop Color="Black" Offset="0.95"/>
                                        <GradientStop Color="{Binding Path=ContactColour}" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Left" ContentSource="Header" Margin="10,0,0,0" Opacity="{Binding Path=ContactNameOpacity}"  />
                            </Border>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="Selector.IsSelected" Value="True">
                                <Setter Property="Background" TargetName="OuterBorder">
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
                                            <GradientStop Color="Yellow" Offset="0"/>
                                            <GradientStop Color="{Binding Path=ContactColour}" Offset="0.5"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Margin" TargetName="InnerBorder" Value="2"/>
                            </Trigger>

                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Opacity" TargetName="ContentSite" Value="0.9"/>
                                <Setter Property="RenderTransform" TargetName="OuterBorder">
                                    <Setter.Value>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1.02" ScaleY="1.1"/>
                                        </TransformGroup>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <DataTrigger Binding="{Binding Path=FlashContact}" Value="True"   >
                                <DataTrigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimationUsingKeyFrames Duration="00:00:01" AutoReverse="False" RepeatBehavior="3x" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                                <DiscreteColorKeyFrame KeyTime="00:00:00" Value="Orange"/>
                                                <DiscreteColorKeyFrame KeyTime="00:00:0.5" Value="Transparent"/>
                                                <DiscreteColorKeyFrame KeyTime="00:00:1" Value="Orange"/>
                                            </ColorAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.EnterActions>
                                <DataTrigger.Setters>

                                </DataTrigger.Setters>

                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=ShowContact}" Value="False">
                                <Setter TargetName="OuterBorder" Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=ShowContact}" Value="True">
                                <Setter TargetName="OuterBorder" Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <ControlTemplate x:Key="TabControlControlTemplate1" TargetType="{x:Type TabControl}">
            <Grid x:Name="Grid" KeyboardNavigation.TabNavigation="Local">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="100" Width="200" MaxWidth="300"/>
                    <ColumnDefinition Width="3"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Border  Grid.Column="2" Grid.RowSpan="3">
                    <ContentPresenter ContentSource="SelectedContent"/>                 
                </Border>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                    <StackPanel.DataContext>
                        <Binding ElementName="MainWindow" Path="MyContactObject" />
                    </StackPanel.DataContext>
                    <ContentPresenter Width="45" Height="45"  HorizontalAlignment="Right" Content="{Binding Path=ContactDisplayImage}" />
                    <StackPanel Margin="1" VerticalAlignment="Center">

                        <StackPanel.DataContext>
                            <Binding ElementName="MainWindow" Path="MyContactObject" />
                        </StackPanel.DataContext>
                        <TextBlock ToolTip="{Binding Path=ContactTooltip}" TextTrimming="CharacterEllipsis" MaxWidth="150"  FontSize="14" Foreground="White" FontFamily="Verdana" Text="{Binding Path=ContactDisplayName}"/>
                        <TextBlock ToolTip="{Binding Path=ContactTooltip}" TextTrimming="CharacterEllipsis" MaxWidth="150" Margin="5,0,0,0"  Text="{Binding Path=ContactDisplayStatus}" FontSize="10" Foreground="White" FontFamily="Verdana" FontStyle="Italic" />
                    </StackPanel>
                </StackPanel>

                <GridSplitter ResizeDirection="Columns" Grid.Column="1" Grid.Row="1"  ResizeBehavior="PreviousAndNext" Width="3" Background="#0068717D"  />
                <Border CornerRadius="9" Grid.Row="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#00000000" Offset="0"/>
                            <GradientStop Color="Transparent" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <ScrollViewer  x:Name="HeaderPanel"   Grid.Column="0"   VerticalScrollBarVisibility="Auto">
                        <StackPanel  IsItemsHost="true" Orientation="Vertical" KeyboardNavigation.TabIndex="1" >
                        </StackPanel>
                    </ScrollViewer>
                </Border>
            </Grid>
        </ControlTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="20" x:Name="_mainMenuRow"/>
            <RowDefinition Height="0" x:Name="_updateRow"/>
            <RowDefinition />
            <RowDefinition Height="0" x:Name="_statusMessageRow"/>
        </Grid.RowDefinitions>    
        <Menu x:Name="_mainMenu" Background="Transparent" Foreground="White" Visibility="Collapsed" FontSize="10" FontFamily="Verdana">
            <MenuItem Header="System" >
                <MenuItem x:Name="ExitMenu" Header="Exit" Click="ExitMenu_Click"  />
            </MenuItem>
            <MenuItem Header="Tools"  >
                <MenuItem x:Name="OnlineOptionsMenu"  Header="Online Options" Click="OnlineOptionsMenu_Click"  />
                <MenuItem x:Name="LocalOptionsMenu" Header="Local Options" Click="LocalOptionsMenu_Click" />
                <Separator/>
                <MenuItem x:Name="HistoryMenu" Header="History Viewer"   />
                <MenuItem x:Name="DebugMenu" Header="Debug"   />
                <MenuItem x:Name="AdminMenu" Header="Administrator Menu"   />
            </MenuItem>
            <MenuItem x:Name="AboutMenu" Header="About" Click="AboutMenu_Click"   />
        </Menu>
        <TextBlock x:Name="_updateMessage" Grid.Row="1" Background="Snow" TextAlignment="Center" Foreground="Gray"  HorizontalAlignment="Stretch" Text="A new update is available, restart to update" FontFamily="Verdana"/>
        
        <TabControl Grid.Row="2" TabStripPlacement="Bottom" Background="Transparent" Name="_mainTabControl" BorderBrush="Transparent" BorderThickness="0">
            <TabItem IsSelected="True" Visibility="Collapsed" Name="_loginTab">
                <Grid VerticalAlignment="Stretch">
                    <StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,50,0,0" MinWidth="420" >
                        <TextBlock Name="_loginMessageTb" HorizontalAlignment="Center" Margin="5,0,0,5" Text="Welcome to Wayne's Global Messenger Beta2" FontFamily="Verdana"  Foreground="#FF0099FF" FontSize="16" FontWeight="Bold"  VerticalAlignment="Bottom" Grid.ColumnSpan="2"  />
                        <Border CornerRadius="10" BorderThickness="1" Margin="0,5,0,0">  
                        <Border.BorderBrush>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                                <GradientStop Color="#FF0099FF" Offset="0"/>
                                <GradientStop Color="LimeGreen" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.BorderBrush>
                            <Grid x:Name="_allLoginControls" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="85*" />
                                <ColumnDefinition Width="205*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="35" />
                                <RowDefinition Height="35" />
                                <RowDefinition Height="35" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <TextBox Margin="0,5,5,5"  x:Name="_usernameTb" BorderThickness="0" Grid.Column="1" FontFamily="Verdana" FontSize="14"  />
                            <TextBlock Margin="5,5,0,5" Text="Username " Foreground="White"  x:Name="textBlock1" FontFamily="Verdana" FontSize="14" HorizontalAlignment="Left"  />
                            <PasswordBox Margin="0,5,5,5" Grid.Row="1"  x:Name="_passwordTB" BorderThickness="0" Grid.Column="1" FontFamily="Verdana" FontSize="14" />
                            <TextBlock Margin="5,5,0,5" Grid.Row="1" Text="Password " Foreground="White"  x:Name="textBlock2" FontFamily="Verdana" FontSize="14"  HorizontalAlignment="Left"  />
                            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="2" Grid.Column="1" Margin="73,0,0,0">
                                <Button Height="20" Width="50" x:Name="_loginBtn" BorderBrush="#00C4B0B0" BorderThickness="1"   Content="Login" Foreground="#FFFFFFFF"  HorizontalAlignment="Left" Click="_loginBtn_Click" IsDefault="True" />
                                <Button Height="20" Width="50" Margin="3,0,5,0" BorderBrush="#00C4B0B0"  HorizontalAlignment="Right"  x:Name="_cancelBtn"  Content="Cancel"  Foreground="#FFFFFFFF" Click="_cancelBtn_Click"/>
                            </StackPanel>
                            <CheckBox Margin="5,5,0,5" Grid.Row="2"  Name="_rememberChk" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="120">
                                <CheckBox.IsChecked>
                                    <Binding Path="RememberLogin" Mode="TwoWay" Source="{x:Static settings:Settings.Default}"/>
                                </CheckBox.IsChecked>
                                <Label Foreground="White" Content="Remember Login"  />
                            </CheckBox>
                            <TextBlock Name="_createAccountBtn" Grid.Row="3" Grid.ColumnSpan="2"  Margin="5,0,0,5" Text="Create Account" FontFamily="Verdana"  Foreground="White"  Cursor="Hand" Height="21" VerticalAlignment="Bottom" HorizontalAlignment="Left"  />
                        </Grid>
                        </Border>
                    </StackPanel>

                    <Image Source="Images\mainicon2.png" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
                </Grid>

            </TabItem>
            <TabItem Name="_networksTab" Visibility="Collapsed" BorderThickness="0" BorderBrush="Transparent">
                <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"  Name="_networksView" Background="Black" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionMode="Single">
                    <ListBox.Resources>
                        <!-- Background of selected item when focussed -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
                        <!-- Background of selected item when not focussed -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />

                        <Style TargetType="ListBox">
                            <Setter Property="ItemsPanel">
                                <Setter.Value>
                                    <ItemsPanelTemplate>
                                        <WrapPanel >
                                        </WrapPanel>
                                    </ItemsPanelTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.Resources>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Border Margin="5"  CornerRadius="5" Width="310" BorderBrush="Transparent" >
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="1,0">
                                        <GradientStop Color="#FF0099FF" Offset="0.8"/>
                                        <GradientStop Color="{Binding NetworkColour}" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>

                                <StackPanel Margin="5" >
                                    <TextBlock Background="Transparent" FontFamily="Verdana" FontSize="16" Width="300" Text="{Binding NetworkName}" Foreground="White" TextTrimming="CharacterEllipsis" ToolTip="{Binding NetworkName}"/>
                                    <TextBlock Background="Transparent" FontFamily="Verdana" FontSize="10" Width="300" Text="{Binding NetworkDescription}" Foreground="White" TextTrimming="CharacterEllipsis" ToolTip="{Binding NetworkDescription}"/>
                                    
                                    <Separator/>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock FontFamily="Verdana" FontSize="10"  Text="Created By " Foreground="White" TextTrimming="CharacterEllipsis" />
                                        <TextBlock FontFamily="Verdana" FontSize="10" MaxWidth="100"  Text="{Binding NetworkCreator}" Foreground="White" TextTrimming="CharacterEllipsis" ToolTip="{Binding NetworkCreator}"/>
                                        <TextBlock FontFamily="Verdana" FontSize="10"  Text=" - Member Count: " Foreground="White" TextTrimming="CharacterEllipsis" />
                                        <TextBlock FontFamily="Verdana" FontSize="10" MaxWidth="100" Text="{Binding NetworkMembersCount}" Foreground="White" TextTrimming="CharacterEllipsis" />

                                    </StackPanel>
                                    <Separator/>
                                    <Grid Width="300">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition/>
                                            <ColumnDefinition Width="95"/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock FontSize="10" Text="Enter Password:" Visibility="{Binding PasswordBoxVisibility}" Foreground="White" FontFamily="Verdana"/>
                                        <TextBox Grid.Column="1" Text="{Binding NetworkPassword, Mode=TwoWay}" Visibility="{Binding PasswordBoxVisibility}" HorizontalAlignment="Stretch" BorderThickness="0"/>
                                        <Button Grid.Column="2" Cursor="Hand" Content="{Binding EnterButtonText}" Name="_enterNetworkBtn" Click="_enterNetworkBtn_Click" HorizontalAlignment="Stretch" Tag="{Binding NetworkName}"/>
                                    </Grid>
                                    <TextBlock Height="4" Visibility="{Binding NetworkStatusVisibility}"/>
                                    <TextBlock HorizontalAlignment="Right" Foreground="White" FontFamily="Verdana" FontSize="10" Text="{Binding NetworkStatusMessage}" Visibility="{Binding NetworkStatusVisibility}"/>
                                </StackPanel>
                            </Border>                                
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </TabItem>
            <TabItem Visibility="Collapsed" BorderBrush="Transparent" BorderThickness="0" Name="_mainTab">
                <Grid Background="#00000000">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TabControl Name="_tabs"  Template="{StaticResource TabControlControlTemplate1}" TabStripPlacement="Left" BorderBrush="Transparent" BorderThickness="0">
                        <TabControl.ContentTemplate >
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="50"/>
                                        <RowDefinition Height="151*" />
                                        <RowDefinition Height="2"/>
                                        <RowDefinition Height="90*" />
                                    </Grid.RowDefinitions>
                                    <StackPanel  Orientation="Horizontal" HorizontalAlignment="Right" >
                                        <StackPanel Margin="1" VerticalAlignment="Center" >
                                            <TextBlock ToolTip="{Binding Path=ContactTooltip}" TextTrimming="CharacterEllipsis" MaxWidth="150" Text="{Binding Path=ContactDisplayName}" FontSize="14" Foreground="White" FontFamily="Verdana" />
                                            <TextBlock ToolTip="{Binding Path=ContactTooltip}" TextTrimming="CharacterEllipsis" MaxWidth="150" Margin="5,0,0,0"  Text="{Binding Path=ContactDisplayStatus}" FontSize="10" Foreground="White" FontFamily="Verdana" FontStyle="Italic" />
                                        </StackPanel>
                                        <ContentPresenter Width="45" Height="45"  HorizontalAlignment="Right" Content="{Binding Path=ContactDisplayImage}" Visibility="Visible" />
                                    </StackPanel>                                    
                                    <ContentPresenter Grid.Row="1" Content="{Binding Path=IncomingViewer}"/>  
                                    <GridSplitter   ResizeDirection="Rows"  Grid.Row="2" HorizontalAlignment="Stretch" ResizeBehavior="PreviousAndNext" Height="2"  VerticalAlignment="Top"  >
                                        <GridSplitter.Background>
                                            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                                <GradientStop Color="White" Offset="0.3"/>
                                                <GradientStop Color="#FF000000" Offset="0.5"/>
                                                <GradientStop Color="White" Offset="0.7"/>
                                            </LinearGradientBrush>
                                        </GridSplitter.Background>
                                    </GridSplitter>
                                    <ContentPresenter Grid.Row="3" Content="{Binding Path=OutgoingTextBox}" />
                                </Grid>
                            </DataTemplate>
                        </TabControl.ContentTemplate>
                        <TabControl.ItemTemplate>
                            <DataTemplate>  
                                <StackPanel Orientation="Horizontal">
                                    <Image Margin="0,0,3,0" Source="Images\has_messages.png" Width="20" VerticalAlignment="Center" HorizontalAlignment="Right" ToolTip="You have an ongoing conversation with this contact, right click for options." Visibility="{Binding Path=HasMessagesVisibility}" >
                                        <Image.ContextMenu>
                                            <ContextMenu>
                                                <MenuItem  IsCheckable="False" Header="Clear messages with this contact." Tag="{Binding Path=ContactUserName}" Click="clearMessages_Click"/>
                                            </ContextMenu>
                                        </Image.ContextMenu>
                                    </Image>
                                    <StackPanel x:Name="ContactItemView" Orientation="Vertical" Tag="{Binding Path=HasUnreadMessages}"  >
                                        <TextBlock ToolTip="{Binding Path=ContactTooltip}"   FontWeight="Bold"  TextTrimming="CharacterEllipsis" Text="{Binding Path=ContactDisplayName}"  Foreground="{Binding Path=ContactHighlightColour}" FontSize="13"  FontFamily="Verdana"/>
                                        <TextBlock ToolTip="{Binding Path=ContactTooltip}" Visibility="{Binding Path=ContactStatusVisibility}"   TextTrimming="WordEllipsis"  Foreground="{Binding Path=ContactHighlightColour}"  FontFamily="Verdana" FontSize="10" FontStyle="Italic" Text="{Binding Path=ContactDisplayStatus}"/>
                                        <Separator Width="Auto" Height="1" Opacity="0" />
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </TabControl.ItemTemplate>
                    </TabControl>
                    <Image Visibility="Collapsed" Focusable="False" x:Name="_unreadMessagesImage" Source="Images\unread_messages.png" Width="100"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0.5"/>

                </Grid>
            </TabItem>
            <TabItem Visibility="Collapsed" Name="_localOptionsTab" BorderBrush="Transparent" BorderThickness="0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>
                    <Border Background="#CC473E3E" BorderThickness="1"  BorderBrush="#3FFFFFFF" CornerRadius="5" HorizontalAlignment="Left" Margin="3" >
                        <ScrollViewer>
                            <StackPanel  Margin="5,5,5,5" HorizontalAlignment="Left" Name="LeftPanel"  >
                                <CheckBox   IsChecked="{Binding Path=KeepMainHistory, Mode=TwoWay, Source={x:Static settings:Settings.Default}}"  Margin="0"  >
                                    <Label Foreground="White" Content="Save Global History"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=KeepPrivateHistory, Mode=TwoWay, Source={x:Static settings:Settings.Default}}"  Margin="0"  >
                                    <Label Foreground="White" Content="Save Private History"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=PopupContactOnline, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"  >
                                    <Label Foreground="White" Content="Popup New User Online"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=PopupContactLeaving, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"  >
                                    <Label Foreground="White" Content="Popup Contact Leaving"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=PopupMessages, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"  >
                                    <Label Foreground="White" Content="Popup Messages"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=FlashMainWindowOnNewMessage, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"  >
                                    <Label Foreground="White" Content="Flash Main Window On New Message"/>
                                </CheckBox> 
                                <CheckBox   IsChecked="{Binding Path=FlashContactListUserOnNewMessage, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"  >
                                    <Label Foreground="White" Content="Flash Contact List User On New Message"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=DisplayUserImage, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Display User Images In Private Windows"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=DisplayMessageTimeDelay, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Display Message Time Delay"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=DisplayDateTimeStamp, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Display Time Stamp For Messages"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=DisplayUserName, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Display User Names For Global Messages"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=RememberLogin, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Remember Login Information"/>
                                </CheckBox>
                                <CheckBox   IsChecked="{Binding Path=AutoScrollMessageWindow, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Auto Scroll Messages"/>
                                </CheckBox>
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Message Retrieve Interval"  HorizontalAlignment="Center"   >

                                </TextBlock>
                                <Slider Name="_localOptionsReceiveInterval" ValueChanged="_localOptionsReceiveInterval_ValueChanged"  Minimum="1" Maximum="20" Value="{Binding Path=ServerReceiveInterval, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" HorizontalAlignment="Stretch" AutoToolTipPlacement="TopLeft"  />

                            </StackPanel>
                        </ScrollViewer>
                    </Border>
                    <Border Background="#CC473E3E" Grid.Column="1" HorizontalAlignment="Right" Margin="3" BorderThickness="1" BorderBrush="#3FFFFFFF" CornerRadius="5,5,5,5">
                        <ScrollViewer>
                            <StackPanel  Margin="5,5,5,5" Name="RightPanel">

                                <ComboBox x:Name="_sFontChooser" ItemsSource="{x:Static Fonts.SystemFontFamilies}" 
        			
        			MaxDropDownHeight="200"
                    HorizontalAlignment="Stretch"
        			FontSize="{Binding Path=SystemFontSize, Mode=OneWay, Source={x:Static settings:Settings.Default}}"
        			 SelectedItem="{Binding Path=SystemFontFamily, Mode=TwoWay, Source={x:Static settings:Settings.Default}}"  />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="System Font Size"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider  Minimum="5" Maximum="20" Value="{Binding Path=SystemFontSize, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" HorizontalAlignment="Stretch" AutoToolTipPlacement="TopLeft"  />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="System Font Colour (Red)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider HorizontalAlignment="Stretch" x:Name="sysColChooserR"   Minimum="0" Maximum="255" Value="{Binding Path=SystemFontColorR, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto"   AutoToolTipPlacement="TopLeft" ValueChanged="sysColChooser_ValueChanged" />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="System Font Colour (Green)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider  x:Name="sysColChooserG"  Minimum="0" Maximum="255" Value="{Binding Path=SystemFontColorG, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="sysColChooser_ValueChanged" />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="System Font Colour (Blue)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider  x:Name="sysColChooserB"  Minimum="0" Maximum="255" Value="{Binding Path=SystemFontColorB, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="sysColChooser_ValueChanged"/>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <CheckBox HorizontalAlignment="Center"   IsChecked="{Binding Path=IsSystemFontBold, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                        <Label Foreground="White" Content="Bold" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                    <CheckBox HorizontalAlignment="Center"   IsChecked="{Binding Path=IsSystemFontItalics, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                        <Label Foreground="White" Content="Italics" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                    <CheckBox HorizontalAlignment="Center"   IsChecked="{Binding Path=IsSystemFontUnderlined, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                        <Label Foreground="White" Content="Underline" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                </StackPanel>
                                <Separator></Separator>
                                <CheckBox HorizontalAlignment="Center"   IsChecked="{Binding Path=OverrideIncomingFonts, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                    <Label Foreground="White" Content="Override Incoming Fonts" FontFamily="Verdana" FontSize="10"/>
                                </CheckBox>
                                <ComboBox x:Name="_oFontChooser" ItemsSource="{x:Static Fonts.SystemFontFamilies}" 
        			HorizontalAlignment="Stretch"
        			MaxDropDownHeight="200"
                    IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}"
        			FontSize="{Binding Path=OverrideIncomingFontSize, Mode=OneWay, Source={x:Static settings:Settings.Default}}"
        			SelectedItem="{Binding Path=OverrideIncomingFontFamily, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Template="{DynamicResource ComboBoxControlTemplate1}" />
                                <TextBlock IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}" Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Override Font Size"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}"  Minimum="5" Maximum="20" Value="{Binding Path=OverrideIncomingFontSize, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" HorizontalAlignment="Stretch" AutoToolTipPlacement="TopLeft" Width="250"  />
                                <TextBlock IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}"  Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Override Font Colour (Red)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}"  x:Name="overColChooserR"   Minimum="0" Maximum="255" Value="{Binding Path=OverrideIncomingFontColourR, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="overColChooser_ValueChanged" />
                                <TextBlock IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}" Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Override Font Colour (Green)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}"  x:Name="overColChooserG"  Minimum="0" Maximum="255" Value="{Binding Path=OverrideIncomingFontColourG, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft"  ValueChanged="overColChooser_ValueChanged"/>
                                <TextBlock IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}" Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Override Font Colour (Blue)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}"  x:Name="overColChooserB"  Minimum="0" Maximum="255" Value="{Binding Path=OverrideIncomingFontColourB, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="overColChooser_ValueChanged" />
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <CheckBox IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}" HorizontalAlignment="Center"   IsChecked="{Binding Path=IsOverrideFontBold, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                        <Label Foreground="White" Content="Bold" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                    <CheckBox IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}" HorizontalAlignment="Center"   IsChecked="{Binding Path=IsOverrideFontItalics, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                        <Label Foreground="White" Content="Italics" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                    <CheckBox IsEnabled="{Binding Path=OverrideIncomingFonts, Mode=OneWay, Source={x:Static settings:Settings.Default}}" HorizontalAlignment="Center"   IsChecked="{Binding Path=IsOverrideFontUnderlined, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Margin="0"   >
                                        <Label Foreground="White" Content="Underline" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                </StackPanel>
                                <Separator></Separator>
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Window Colour Scheme (Red)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider  x:Name="winColChooserR"  Minimum="0" Maximum="255" Value="{Binding Path=WindowColorR, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="winColChooser_ValueChanged" />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Window Colour Scheme (Green)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider  x:Name="winColChooserG"  Minimum="0" Maximum="255" Value="{Binding Path=WindowColorG, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft"  ValueChanged="winColChooser_ValueChanged"/>
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Window Colour Scheme (Blue)"  HorizontalAlignment="Center"   >

                            </TextBlock>
                                <Slider x:Name="winColChooserB"  Minimum="0" Maximum="255" Value="{Binding Path=WindowColorB, Mode=TwoWay, Source={x:Static settings:Settings.Default}}" Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="winColChooser_ValueChanged" />


                            </StackPanel>
                        </ScrollViewer>
                    </Border>

                    <TextBlock Grid.Row="1" Foreground="Red" FontSize="16" FontFamily="Verdana" Cursor="Hand"   Text="Reset To Defaults"  HorizontalAlignment="Left"  x:Name="_resetBtn" MouseDown="_resetBtn_MouseDown" VerticalAlignment="Bottom" Height="18.23" Width="133.03">
                        <TextBlock.Effect>
                            <DropShadowEffect/>
                        </TextBlock.Effect>
                    </TextBlock>
                    <TextBlock Grid.Row="1" MouseDown="_doneBtn_MouseDown" Grid.Column="1" Foreground="White" FontSize="15" FontFamily="Verdana" Cursor="Hand"   Text="Done"  HorizontalAlignment="Right"  x:Name="_doneBtn" VerticalAlignment="Bottom"  >
                        <TextBlock.Effect>
                            <DropShadowEffect/>
                        </TextBlock.Effect>
                    </TextBlock>
                </Grid>
            </TabItem>
            <TabItem Visibility="Collapsed" Name="_onlineOptionsTab" BorderBrush="Transparent" BorderThickness="0" >
                <Grid Name="_allOnlineOptionsControls" MaxHeight="300" MaxWidth="450" HorizontalAlignment="Left" VerticalAlignment="Top" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>                            
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="30"/>
                    </Grid.RowDefinitions>
                    <Border HorizontalAlignment="Left" Margin="5" BorderThickness="1" BorderBrush="#3FFFFFFF" CornerRadius="5,5,5,5">
                        <ScrollViewer VerticalAlignment="Top" HorizontalAlignment="Left" HorizontalContentAlignment="Left" VerticalContentAlignment="Top">
                            <StackPanel  Margin="5,5,5,5" VerticalAlignment="Top" HorizontalAlignment="Left" >
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Display Name"  HorizontalAlignment="Center"   ></TextBlock>
                                <TextBox Name="_onlineOptionsDisplayNameTB"/>
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Display Status"  HorizontalAlignment="Center"   ></TextBlock>
                                <TextBox Name="_onlineOptionsDisplayStatusTB" />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Font Name"  HorizontalAlignment="Center"   ></TextBlock>
                                <ComboBox x:Name="_onlineOptionsFontChooser" ItemsSource="{x:Static Fonts.SystemFontFamilies}" MaxDropDownHeight="200" Width="250" HorizontalAlignment="Stretch"/>
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Font Size"  HorizontalAlignment="Center"   ></TextBlock>
                                <Slider Width="190" Name="_onlineOptionsFontSize"  Minimum="5" Maximum="20" HorizontalAlignment="Stretch" AutoToolTipPlacement="TopLeft" ValueChanged="_onlineOptionsSlider_ValueChanged"  />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Font Colour (Red)"  HorizontalAlignment="Center"   ></TextBlock>
                                <Slider Width="190" x:Name="_onlineOptionsFontColourR"   Minimum="0" Maximum="255"  Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="_onlineOptionsSlider_ValueChanged" />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Font Colour (Green)"  HorizontalAlignment="Center"   ></TextBlock>
                                <Slider Width="190" x:Name="_onlineOptionsFontColourG"  Minimum="0" Maximum="255"  Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="_onlineOptionsSlider_ValueChanged" />
                                <TextBlock Foreground="White" FontSize="10" FontFamily="Verdana"  Text="Font Colour (Blue)"  HorizontalAlignment="Center"   ></TextBlock>
                                <Slider Width="190" x:Name="_onlineOptionsFontColourB"  Minimum="0" Maximum="255"  Height="Auto" HorizontalAlignment="Stretch"  AutoToolTipPlacement="TopLeft" ValueChanged="_onlineOptionsSlider_ValueChanged" />
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <CheckBox Name="_onlineOptionsIsBold" HorizontalAlignment="Center"   Margin="0" Checked="_onlineOptionsCheckBox_Changed" Unchecked="_onlineOptionsCheckBox_Changed" Foreground="Black" >
                                        <Label Foreground="White" Content="Bold" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                    <CheckBox HorizontalAlignment="Center" Name="_onlineOptionsIsItalics" Margin="0" Checked="_onlineOptionsCheckBox_Changed" Unchecked="_onlineOptionsCheckBox_Changed" Foreground="Black" >
                                        <Label Foreground="White" Content="Italics" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                    <CheckBox HorizontalAlignment="Center" Name="_onlineOptionsIsUnderlined" Margin="0" Checked="_onlineOptionsCheckBox_Changed" Unchecked="_onlineOptionsCheckBox_Changed" Foreground="Black" >
                                        <Label Foreground="White" Content="Underline" FontFamily="Verdana" FontSize="10"/>
                                    </CheckBox>
                                </StackPanel>
                            </StackPanel>
                        </ScrollViewer>
                        
                    </Border>


                    <StackPanel HorizontalAlignment="Right" Margin="5" Grid.Column="1">
                        <ContentPresenter Cursor="Hand" MouseDown="_onlineOptionsDisplayImage_MouseDown" x:Name="_onlineOptionsDisplayImage" Width="150" Height="150" ToolTip="Click to browse for a new image">
                        </ContentPresenter>
                        <TextBlock Name="_onlineOptionsClearImgBtn" MouseDown="_onlineOptionsClearImgBtn_MouseDown" ToolTip="Click if you do not want to use a dislay image" Text="Clear Image" FontFamily="Verdana" Foreground="White" FontSize="14"  HorizontalAlignment="Center" Cursor="Hand"/>
                    </StackPanel>

                    <StackPanel Orientation="Horizontal" Grid.Row="1">
                        <TextBlock Foreground="Red" FontSize="16" FontFamily="Verdana" Cursor="Hand"   Text="Reset"  HorizontalAlignment="Left"  x:Name="_onlineOptionsResetBtn" MouseDown="_onlineOptionsResetBtn_MouseDown" VerticalAlignment="Bottom" Height="18.23" >

                        </TextBlock>
                        <TextBlock Foreground="LightGreen" FontSize="15" FontFamily="Verdana" Cursor="Hand"   Text="Commit"  HorizontalAlignment="Right" Margin="10,0,0,0" x:Name="_onlineOptionsDoneBtn" MouseDown="_onlineOptionsDoneBtn_MouseDown" VerticalAlignment="Bottom"  >

                        </TextBlock>
                        <TextBlock Cursor="Hand" FontFamily="Verdana" FontSize="15" Foreground="White" Height="18.23" HorizontalAlignment="Right" Margin="10,0,0,0" Name="_onlineOptionsCancelBtn" Text="Cancel" VerticalAlignment="Bottom" Width="58.783" MouseDown="_onlineOptionsCancelBtn_MouseDown" ></TextBlock>

                    </StackPanel>
                </Grid>
            </TabItem>
        </TabControl>
        <TextBlock x:Name="_statusMessage" Grid.Row="3"  TextAlignment="Center" Foreground="Black"  HorizontalAlignment="Stretch" Text="You are currently experiencing connection issues..." FontFamily="Verdana"/>

    </Grid>

</Window>
